import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import 'babel-polyfill'
import './assets/js/preventRepeatClick.js'
import componentLib from './installComponents.js'
import axios from 'axios'
import Print from 'vue-print-nb'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min'
import storeSave from '@/store/storesave'
import AFTableColumn from 'af-table-column'
import VueRouter from 'vue-router'
// import VComList from '@/components/index.js'//引用全局组件Button'
import * as echarts from 'echarts'
import Icon from 'vue-svg-icon/Icon'
import dataV from '@jiaminghi/data-view'
Vue.use(dataV)
Vue.component('icon', Icon)
process.env.MOCK && require('@/mock')
Vue.prototype.$storeSave = storeSave
Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts
Vue.use(VueRouter)

Vue.config.productionTip = false
Vue.use(componentLib)
Vue.use(Print)
Vue.use(AFTableColumn)
// Vue.use(VComList)
Vue.config.productionTip = false
Vue.directive('enterNumber2', {
    inserted: function (el) {
        el.addEventListener('keypress', function (e) {
            e = e || window.event
            let charcode = typeof e.charCode === 'number' ? e.charCode : e.keyCode
            let re = /\d/
            if (charcode == 46) {
                if (el.value.includes('.')) {
                    e.preventDefault()
                }
            } else if (!re.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey) {
                if (e.preventDefault) {
                    e.preventDefault()
                } else {
                    e.returnValue = false
                }
            }
        })
    }
})
/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    store,
    storeSave,
    components: {
        App
    },
    template: '<App/>'
})
